
<link href="${rc.getContextPath()}/manage/css/dwzCustomCss/dwz.custom.css?v=${ver}" rel="stylesheet" type="text/css">
<div class="pageContent uiComplete">
    <input id="workCenterTypeCode" type="hidden">
    <input id="selectNode" type="hidden" value="${selectNode!''}">
                <div class="treeleft">
                    <div class="mini-toolbar" >                
                            <input type="text" id="search" />
                            <a class="buttonActive" href="javascript:void(0)" id="searchTree"><span ><@label key='search.B'>搜索</@label></span></a>                
                    </div>
                    <div id="bar" class="pBar pBarBorder">
                        <ul class="toolBar">
                            <@buttonRight menuCode="wcType_add" labelKey="add.B" defalutName="新增">
                            <li><a id="new" class="add"><span><@label key="add.B">新增</@label></span> </a></li> </@buttonRight>

                            <div id="list" class="divlist">
                                <ul>
                                    <li><a href="${rc.getContextPath()}/manage/workCenterType/addWcType?navTabId=${navTabId!''}" target="ajax" rel="wctDetail"><@label key="addTop.B">新增顶级项</@label></a></li>
                                    <li><a id="addChild" target="ajax" rel="" href="javascript:void(0);" onclick="workCenterTypeOperation()"><@label key="addchild.B">新增子项</@label></a></li>
                                </ul>
                            </div>
                            <@buttonRight menuCode="wcType_edit" labelKey="edit.B" defalutName="编辑">
                            <li><a id="editWct" href="javascript:void(0);" target="ajax" rel="" class="edit" title="<@label key="editWorkCenterType.D">编辑工作中心类型</@label>" onclick="workCenterTypeOperation()"><span><@label key="edit.B">编辑</@label></span> </a>
                            </li> </@buttonRight> <@buttonRight menuCode="wcType_del" labelKey="delete.B" defalutName="删除">
                            <li><a id="deleteWct" class="delete" href="javascript:void(0);" onclick="workCenterTypeOperation()" title="<@label key="confirmDelWorkCenterType.M">确认要删除当前选择的工作中心类型吗？</@label>"><span><@label key="delete.B">删除</@label></span> </a>
                            </li> </@buttonRight>
                        </ul>
                    </div>
                    <div id="menuBar" class="pBar pBarBorder">
                        <ul class="toolBar">
                            <li><a class="collapse" id="collapsable" title="<@label key="collapseAll.D">全部收起</@label>"><span><@label key="collapse.B">收起</@label></span> </a>
                            </li>
                            <li><a class="expand" id="expandable" title="<@label key="expandAll.D">全部展开</@label>"><span><@label key="expand.B">展开</@label></span> </a>
                            </li>
                        </ul>
                    </div>

                    <div layoutH="96" class="treebody">
                            <ul id="tree" class="tree treeFolder expand">
                                <#list treeList as tree>
                                <li><a target="ajax" rel="wctDetail" tvalue="${tree.workCenterTypeCode}" href="${rc.getContextPath()}/manage/workCenterType/viewWcType?id=${tree.workCenterTypeCode}&navTabId=${navTabId!''}" onclick="workCenterTypeNodeClick(this)">${tree.typeText}</a> <#if tree.children?? &&tree.children?size gt 0>
                                    <ul><@bpTree children=tree.children />
                                    </ul> </#if> </#list>
                            </ul>
                    </div>

                </div>
                <div id="wctDetail" class="unitBox treeBox">
                    <div class="treeTip"><@label key="treeTips.M">请点击左侧树形菜单进行相关操作</@label></div>
                </div>

            </div>
        </div>
        <div class="tabsFooter">
            <div class="tabsFooterContent"></div>
        </div>
    </div>

</div>
<!-- 递归产生树的宏定义 -->
<#macro bpTree children> <#if children?? && children?size gt 0> <#list children as child>
<li><a tvalue="${child.workCenterTypeCode}" target="ajax" rel="wctDetail" href="${rc.getContextPath()}/manage/workCenterType/viewWcType?id=${child.workCenterTypeCode}&navTabId=${navTabId!''}" onclick="workCenterTypeNodeClick(this)">${child.typeText}</a> <#if child.children?? &&child.children?size gt 0>
    <ul><@bpTree children=child.children />
    </ul> </#if> </#list> </#if> </#macro>
    
    <script type="text/javascript">
    $(function(){
        var $page = navTab.getCurrentPanel();
        $("#searchTree",$page).baseTreeSearch({
            inputTextId : "#search", //搜索框的id
            alertMsg : "<@label key='Tree_search_Input.D'>输入名称进行查询</@label>", //提示内容，要考虑国际化，传自后台
            $p : navTab.getCurrentPanel()
            });
        $("#collapsable",$page)._treeCollapsable({
            $p : navTab.getCurrentPanel()
        });
        
        $("#expandable",$page)._treeExpandable({
            $p : navTab.getCurrentPanel()
        });
        
        $('.uiComplete',$page).on('uiComplete', function(){
            var selectNode = $("#selectNode",$page).val();
            if(selectNode){
                $(this)._searchByValue({
                    searchValue:selectNode,
                    $p : navTab.getCurrentPanel()
                });
            }
        });
        
        $("#new",$page).hover(
                function() {
                    $("#list",navTab.getCurrentPanel()).attr("style", "display: block");
                })
         $("#list",$page).mouseleave(function(){
             $("#list",navTab.getCurrentPanel()).attr("style", "");
        });
    })
    
    function workCenterTypeNodeClick(ob){
        var $page = navTab.getCurrentPanel();
        var value=$(ob).attr("tvalue");
        $("#workCenterTypeCode",$page).val(value);
        $("#addChild",$page).attr("href", "${rc.getContextPath()}/manage/workCenterType/addWcType?id="+value+"&navTabId=${navTabId!''}");
        $("#addChild",$page).attr("rel", "wctDetail");
        $("#editWct",$page).attr("href", "${rc.getContextPath()}/manage/workCenterType/editWcType?id="+value+"&navTabId=${navTabId!''}");
        $("#editWct",$page).attr("rel", "wctDetail");
        $("#deleteWct",$page).attr("href", "${rc.getContextPath()}/manage/workCenterType/deleteWcType?id="+value+"&navTabId=${navTabId!''}");
        $("#deleteWct",$page).attr("target", "ajaxTodo");
        initUI($("#bar",$page));
        initUI($("#menuBar",$page));
    }
    
    
    function workCenterTypeOperation(){
        if($("#workCenterTypeCode",navTab.getCurrentPanel()).val()=="")
            {
            alertMsg.warn('<@label key="selectNode.M">请先选择一个节点！</@label>')
        
            }
    }
    

</script>